package se.teamstat.client;

import se.teamstat.client.gui.CenterPanel;
import se.teamstat.client.gui.EastPanel;
import se.teamstat.client.gui.NorthPanel;
import se.teamstat.client.gui.WestPanel;
import se.teamstat.client.gui.data.WestData;

import com.google.gwt.core.client.EntryPoint;
import com.gwtext.client.core.RegionPosition;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Viewport;
import com.gwtext.client.widgets.layout.BorderLayout;
import com.gwtext.client.widgets.layout.BorderLayoutData;
import com.gwtext.client.widgets.layout.FitLayout;

public class Teamstat implements EntryPoint {
	
	public void onModuleLoad()  {
		Panel panel = createMainPanel();
        
		Panel borderPanel = createBorderPanel(); 
        createNorthPanel(borderPanel);   
        createEastPanel(borderPanel);   
        createWestPanel(borderPanel);
        createCenterPanel(borderPanel);   
  
        panel.add(borderPanel);   
  
        new Viewport(panel);

	}

	private void createCenterPanel(Panel borderPanel) {
		Panel centerPanel = new CenterPanel();
        borderPanel.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER));
	}

	private void createWestPanel(Panel borderPanel) {
		Panel westPanel = new WestPanel();
		BorderLayoutData westData = new WestData(RegionPosition.WEST);
        borderPanel.add(westPanel, westData);   
	}

	private void createEastPanel(Panel borderPanel) {
		Panel eastPanel = new EastPanel();
		BorderLayoutData eastData = new WestData(RegionPosition.EAST);
        borderPanel.add(eastPanel, eastData);
	}

	private void createNorthPanel(Panel borderPanel) {
		Panel northPanel = new NorthPanel();
        borderPanel.add(northPanel, new BorderLayoutData(RegionPosition.NORTH));
	}

	private Panel createBorderPanel() {
		Panel borderPanel = new Panel();
        BorderLayout borderLayout = new BorderLayout();
        borderPanel.setLayout(borderLayout);
		return borderPanel;
	}

	private Panel createMainPanel() {
		Panel panel = new Panel();   
        panel.setBorder(false);   
        panel.setPaddings(15);   
        panel.setLayout(new FitLayout());
		return panel;
	}
	
	
}

